package com.example.ormsqlsplicingframe1.session;

import com.example.ormsqlsplicingframe1.sql.DeleteSql;
import com.example.ormsqlsplicingframe1.sql.InsertSql;
import com.example.ormsqlsplicingframe1.sql.SelectSql;
import com.example.ormsqlsplicingframe1.sql.UpdateSql;

import java.util.List;

public interface EntitySession {


    int insert(InsertSql sql);

    int update(UpdateSql sql);

    int delete(DeleteSql sql);

    <E> List<E> select(SelectSql sql, Class<E> clazz);

    <E> E selectOnt(SelectSql sql, Class<E> clazz);

    long count(SelectSql sql);

   default void startTransaction(){
        startTransaction(false);
    }
    //开启事务
    void startTransaction(boolean spring);

    //提交事务
    void commitTransaction();

    //回滚事务
    void rollbackTransaction();

    boolean isOpenTransaction();

}
